// 2013-7-29下午04:35:53  net.betou.trade.main.dao.impl.NoticeTypeDaoImpl.java

package net.betou.trade.main.dao.impl;

import java.util.List;

import net.betou.common.hibernate3.Finder;
import net.betou.common.hibernate3.HibernateBaseDao;
import net.betou.trade.entity.main.NoticeType;
import net.betou.trade.main.dao.NoticeTypeDao;

import org.springframework.stereotype.Repository;

/**
 * 
 * @author 叶装装
 */
@Repository
public class NoticeTypeDaoImpl extends HibernateBaseDao< NoticeType, Integer > implements NoticeTypeDao{

	public NoticeType deleteById( Integer id ) {
		NoticeType bean = get( id );
		if( bean != null ){
			getSession( ).delete( bean );
		}
		
		return bean;
	}

	public NoticeType findById( Integer id ) {
		return get( id );
	}

	public NoticeType findByIdentity( String identity ) {
		String hql = "from NoticeType bean where bean.identity=?";
		return ( NoticeType ) findUniqueCacheable( hql, identity ); // 缓存起来
	}

	@SuppressWarnings( "unchecked" )
	public List< NoticeType > getNoticeTypeList( String searchProperty, String searchValue, String orderProperty, String orderDirection ) {
		Finder f = Finder.create( "from NoticeType bean where 1=1 " );
		createSearch( f, searchProperty, searchValue );
		createOrder( f, orderProperty, orderDirection, "id" );
		return find( f, true );
	}

	public NoticeType save( NoticeType bean ) {
		getSession( ).save( bean );
		return bean;
	}


	@Override
	protected Class< NoticeType > getEntityClass( ) {
		return NoticeType.class;
	}

}
